package org.example.myleet.p1518;

public class Solution {
    public int numWaterBottles(int numBottles, int numExchange) {
        int sum = numBottles, emptyBottle = numBottles;
        while (emptyBottle >= numExchange) {
            numBottles = emptyBottle / numExchange;
            emptyBottle = emptyBottle % numExchange;
            sum += numBottles;
            emptyBottle += numBottles;
        }
        return sum;
    }
}
